package com.aurora_manito.xiaomi.utils;

import java.math.BigInteger;
import java.security.MessageDigest;


public class Md5Utils {
    public static String md5(String str){
        try {
            //创建消息摘要
            MessageDigest messageDigest=MessageDigest.getInstance("MD5");
            //更新
            messageDigest.update(str.getBytes("utf-8"));
            byte[] digest=messageDigest.digest();
            BigInteger bigInteger=new BigInteger(1,digest);
            String secret=bigInteger.toString(16);
            System.out.println(secret);
            return secret;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
